Ext.define('AkData.store.DokumaKumasSiparisler_Store', {
	alias: 'store.DokumaKumasSiparisler_Store',
	extend: 'Ext.data.Store',
	config: {
		storeId: 'DokumaKumasSiparisler_Store',
		autoLoad: false,
		//fields: ['id', 'hafta', 'saten', 'gabardin', 'poplin', 'diger'],
		
		fields: [
			{name: 'id', type: 'int'},
			{name: 'periyod', type: 'string'},
			{name: 'gabardin', type: 'int', mapping: function(data, record) {return parseInt(data.gabardin) / AkData.app.Bolum;}},
			{name: 'poplin', type: 'int', mapping: function(data, record) {return parseInt(data.poplin) / AkData.app.Bolum;}},
			{name: 'saten', type: 'int', mapping: function(data, record) {return parseInt(data.saten) / AkData.app.Bolum;}},
			{name: 'diger', type: 'int', mapping: function(data, record) {return parseInt(data.diger) / AkData.app.Bolum;}},
			
			{name: 'toplam_sum', type: 'int', mapping: function(data, record) {return parseInt(data.toplam_sum) / AkData.app.Bolum;}},
			
			{name: 'hedef', type: 'int', mapping: function(data, record) {return parseInt(data.hedef) / AkData.app.Bolum;}},
			{name: 'gercek', type: 'int',
				mapping: function(data, record) {
					return (parseInt(data.gabardin) + parseInt(data.poplin) + parseInt(data.saten) + parseInt(data.diger)) / AkData.app.Bolum;
				}
			},
			
			{name: 'yuzde', type: 'int', mapping: function(data, record) {
				return Math.round(Math.round((Math.round(data.gabardin) + Math.round(data.poplin) + Math.round(data.saten) + Math.round(data.diger))) / Math.round(data.toplam_sum) * 100);
				}
			},
		],
		
		proxy: {
			type: 'ajax', simpleSortMode: true,
			url: 'php/select.php?table=DokumaKumasSiparisler',
			reader: {type: 'json', idProperty: 'id', messageProperty: 'message', totalProperty: 'total', rootProperty: 'data'}
		},
	},
});